package com.mbsnjdxyry.tracord_backend.controller;

import com.mbsnjdxyry.tracord_backend.common.ResponseResult;
import com.mbsnjdxyry.tracord_backend.common.ResultCode;
import com.mbsnjdxyry.tracord_backend.domain.dto.ArgumentDto;
import com.mbsnjdxyry.tracord_backend.service.AsyncService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/async")
public class AsyncController {

    @Autowired
    private AsyncService asyncService;

    @PostMapping
    public ResponseResult setAsyncRes(){
        asyncService.setAsyncRes();
        return ResponseResult.success(ResultCode.ASYNC_SUCCESS,"正在拼命计算中...");
    }

    @GetMapping
    public ResponseResult getAsyncRes(){
        return asyncService.getAsyncRes();
    }

//    @PostMapping
//    public List<String> argumentApi(@RequestBody ArgumentDto argumentDto){
//        List<String> res = new ArrayList<>();
//        res.add("123");
//        res.add("456");
//        res.add("789");
//        return res;
//    }
}
